package com.sky.controller.backstage;

import com.sky.dto.BackstageArticleUpdateDTO;
import com.sky.dto.BackstageTagQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.BackstageTagService;
import com.sky.vo.BackstageTagVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 贾晓晨
 * @version 1.0
 */
@RestController
@RequestMapping("/backstage/tag")
@Slf4j
@Api(tags = "后台标签管理接口")
public class BackstageTagController {
    @Autowired
    private BackstageTagService backstageTagService;

    @GetMapping(value = {"/getListByName/{tag}", "/getListByName"})
    @ApiOperation("获取tag")
    public Result<List<BackstageTagVO>> getTagList(@PathVariable(value = "tag", required = false) String tag) {
        List<BackstageTagVO> tagList = backstageTagService.getTagList(tag);
        return Result.success(tagList);
    }

    @GetMapping
    @ApiOperation("分页获取tag")
    public Result<PageResult> getTagList(BackstageTagQueryDTO backstageTagQueryDTO) {
        PageResult articleInfoList = backstageTagService.getTag(backstageTagQueryDTO);
        return Result.success(articleInfoList);
    }

    @DeleteMapping
    @ApiOperation("删除标签")
    public Result deleteUser(@RequestBody List<Integer> ids) {
        backstageTagService.deleteTag(ids);
        return Result.success("删除成功");
    }

    // 删除

    // 添加


}
